//
//  VipCardRecordDetailTableViewCell.m
//  fitnessmanage
//
//  Created by 众拳科技 on 2017/11/1.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "VipCardRecordDetailTableViewCell.h"

@implementation VipCardRecordDetailTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        /**
         标题
         */
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.font = MidBigFont;
        titleLabel.textColor = CSColorFromRGB(0x212121);
        titleLabel.text = @"充值";
        [self.contentView addSubview:titleLabel];
        self.titleLabel =  titleLabel;
        
        /**
         详情
         */
        UILabel *detailLabel = [[UILabel alloc] init];
        detailLabel.font = [UIFont systemFontOfSize:13.0];
        detailLabel.textColor = CSColorFromRGB(0x999999);
        detailLabel.text = @"2017-11-26 12:24";
        [self.contentView addSubview:detailLabel];
        self.detailLabel =  detailLabel;
        
        UILabel *priceLabel = [[UILabel alloc] init];
        priceLabel.font = [UIFont systemFontOfSize:20.0];
        priceLabel.textColor = CSColorFromRGB(0x212121);
        priceLabel.text = @"+10000";
        [self.contentView addSubview:priceLabel];
        self.priceLabel = priceLabel;
        
        [self setConstraints];
        
    }
    
    return self;
}

-(void)setConstraints{
    
    /**
     标题
     */
    [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.contentView).offset(20);
        
        make.left.mas_equalTo(self.contentView).offset(15);
        
    }];
    
    /**
     详情
     */
    [self.detailLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.bottom.mas_equalTo(self.contentView).offset(-17);
        
        make.left.mas_equalTo(self.titleLabel);
    }];
    
    [self.priceLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(self.contentView);
        
        make.right.mas_equalTo(self.contentView).offset(-15);
    }];
}

- (void)drawRect:(CGRect)rect
{
    CGContextRef context =UIGraphicsGetCurrentContext();
    
    CGContextBeginPath(context);
    
    CGContextSetLineWidth(context,1.0);//线宽度
    
    CGContextSetStrokeColorWithColor(context,LineBackGroundColor.CGColor);
    
    CGContextMoveToPoint(context,self.titleLabel.left,rect.size.height);
    
    CGContextAddLineToPoint(context,SCREEN_WIDTH - 15,rect.size.height);
    
    CGContextStrokePath(context);
}

@end
